package com.ss.android.f.c;

import android.os.Build;

import com.bytedance.common.utility.Logger;
import com.ss.android.common.util.ToolUtils;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public final class a {
    private static final CharSequence a;
    private static final CharSequence b;

    static {
        a = "amigo";
        b = "funtouch";
    }

    public static String a() {
        String v0;
        if(ToolUtils.isMiui()) {
            v0 = ToolUtils.isMiui() ? "miui_" + a("ro.miui.ui.version.name") + "_" + Build.VERSION.INCREMENTAL : "";
        }
        else if(ToolUtils.c()) {
            v0 = Build.DISPLAY;
            if(v0 != null && (v0.toLowerCase().contains("flyme"))) {
                return v0;
            }

            v0 = "";
        }
        else {
            if(b()) {
                if(b()) {
                    return "coloros_" + a("ro.build.version.opporom") + "_" + Build.DISPLAY;
                }

                return "";
            }

            v0 = ToolUtils.getEmuiInfo();
            v0 = v0 == null || !v0.toLowerCase().contains("emotionui") ? "" : v0 + "_" + Build.DISPLAY;
            if(!android.support.design.a.isTextEmpty(v0)) {
                return v0;
            }

            v0 = a("ro.vivo.os.build.display.id");
            int v0_1 = (android.support.design.a.isTextEmpty(v0)) || !v0.toLowerCase().contains(b) ? 0 : 1;
            if(v0_1 != 0) {
                return a("ro.vivo.os.build.display.id") + "_" + a("ro.vivo.product.version");
            }

            v0_1 = (android.support.design.a.isTextEmpty(Build.DISPLAY)) || !Build.DISPLAY.toLowerCase().contains(a) ? 0 : 1;
            if(v0_1 != 0) {
                return Build.DISPLAY + "_" + a("ro.gn.sv.version");
            }

            v0 = Build.MANUFACTURER + Build.BRAND;
            if(!android.support.design.a.isTextEmpty(v0)) {
                v0 = v0.toLowerCase();
                if(!v0.contains("360") && !v0.contains("qiku")) {
                    v0_1 = 0;
                }else {
                    v0_1 = 1;
                }
            }
            else {
                v0_1 = 0;
            }

            if(v0_1 != 0) {
                return a("ro.build.uiversion") + "_" + Build.DISPLAY;
            }

            v0_1 = !android.support.design.a.isTextEmpty(a("ro.letv.release.version")) ? 1 : 0;
            v0 = v0_1 != 0 ? "eui_" + a("ro.letv.release.version") + "_" + Build.DISPLAY : "";
            if(!android.support.design.a.isTextEmpty(v0)) {
                return v0;
            }

            v0 = Build.DISPLAY;
        }

        return v0;
    }

    private static String a(String arg6) {
        String v0_1 = null;
        Throwable v1_1;
        BufferedReader v2 = null;
        Process v4 = null;
        String v3 = "";
        BufferedReader v1 = null;
        try {
            v4 = Runtime.getRuntime().exec("getprop " + arg6);
            v2 = new BufferedReader(new InputStreamReader(v4.getInputStream()), 1024);
            v0_1 = v2.readLine();
        }
        catch(Throwable v0) {
            Logger.e("ToolUtils", "Unable to read sysprop " + arg6, v0);
        }finally {
            try {
                v4.destroy();
            }
            catch(Throwable ex) {
            }

            try {
                v2.close();
            }
            catch(IOException v1_2) {
                Logger.e("ToolUtils", "Exception while closing InputStream", ((Throwable)v1_2));
            }
        }
        return v0_1;
    }

    private static boolean b() {
        String v0 = Build.MANUFACTURER;
        boolean v0_1 = !android.support.design.a.isTextEmpty(v0) ? v0.toLowerCase().contains("oppo") : false;
        return v0_1;
    }
}

